package com.briup.day10;

import java.util.Objects;

/**
 * @author lining
 * @date 2024/1/19 14:11
 */
public class Student {
    private int id;
    private String name;
    //学号相同的信息才是同一个学生信息。重写equals hashcode


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return id == student.id;
    }

    @Override
    public int hashCode() {
        //return id;
        //return 31+id.hashcode();
        return Objects.hash(id);
    }
}
